﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_orderinfo.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.trade.ts_area.*" %>
<%@page import="com.lmpop.trade.tb_commpara.Tb_commparaInfo" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%@page import="com.lmpop.trade.ti_evaluate.Ti_evaluateInfo" %>
<%@ page import="com.lmpop.trade.ti_memcomplaint.*" %>

 <%
 request.setCharacterEncoding("UTF-8");
	Hashtable params = new Hashtable();
	params.put("user_id",user_id);
	Ti_orderinfoInfo ti_orderinfoInfo = new Ti_orderinfoInfo();
	Tb_commparaInfo commparaInfo = new Tb_commparaInfo();
	Ti_evaluateInfo evaluateInfo = new Ti_evaluateInfo();
	String s_order_no="",o_start_date="",o_end_date="",o_order_state="";
  if(request.getParameter("s_order_no")!=null && !request.getParameter("s_order_no").equals(""))
  {
      s_order_no = request.getParameter("s_order_no"); 
      params.put("order_no",s_order_no);
  }
  
  
 if(request.getParameter("o_start_date")!=null && !request.getParameter("o_start_date").equals(""))
  {
      o_start_date = request.getParameter("o_start_date"); 
      params.put("o_start_date",o_start_date); 
  }
  if(request.getParameter("o_end_date")!=null && !request.getParameter("o_end_date").equals(""))
  {
      o_end_date = request.getParameter("o_end_date"); 
      params.put("o_end_date",o_end_date); 
  }
  if(request.getParameter("o_order_state")!=null && !request.getParameter("o_order_state").equals(""))
  {
      o_order_state = request.getParameter("o_order_state"); 
      params.put("order_state",o_order_state); 
  }
 	String iStart = "0";

	int limit = 10;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");

	List list = ti_orderinfoInfo.getPersonalListByPage(params,Integer.parseInt(iStart),limit);
	int counter = ti_orderinfoInfo.getPersonalCountByObj(params);

  String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?o_order_state="+o_order_state+"&o_end_date="+o_end_date+"&o_start_date="+o_start_date+"&s_order_no="+s_order_no+"&menu_id="+menu_id+"&iStart=",Integer.parseInt(iStart),limit);

  Tb_commparaInfo tb_commparaInfo = new Tb_commparaInfo();
  String ordersource = tb_commparaInfo.getSelectItem("16","");
  Ts_areaInfo areaBean = new Ts_areaInfo();
  String  paid = "0";
  if(ti_orderinfoInfo.getall_paidByID(user_id) != null && !ti_orderinfoInfo.getall_paidByID(user_id).trim().equals("")){
	paid = ti_orderinfoInfo.getall_paidByID(user_id);
  }
  
  List calsslist = null;//ti_orderinfoInfo.getPersonallevel(user_id);
  String level_name="",discount="";
  if(calsslist!=null && calsslist.size()>0){
		for(int i=0;i<calsslist.size();i++){
		  Hashtable map = (Hashtable)calsslist.get(i);
		  if(map.get("class_name")!=null) level_name = map.get("class_name").toString();
		  if(map.get("discount")!=null) discount = map.get("discount").toString();
		}
  }
  
 String user_name = "";	
	if( session.getAttribute("session_user_name") != null ){
		user_name = session.getAttribute("session_user_name").toString();
	}
	java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd"); 

	java.util.Date currentTime = new java.util.Date();//得到当前系统时间 

	String str_date1 = formatter.format(currentTime); //将日期时间格式化 
	String str_date2 = currentTime.toString(); //将Date型日期时间转换成字符串形式 

	List orderStateList = ti_orderinfoInfo.getOrderInfoStateNum(user_id);
     	 
	String waitPay="0",waitConfirmShip="0",waitComment="0";
	if(orderStateList!=null && orderStateList.size()>0){
		Hashtable oMap = new Hashtable();
		for(int i=0;i<orderStateList.size();i++){
			oMap = (Hashtable)orderStateList.get(i);
			String _order_state="",_num="";
			if(oMap.get("order_state")!=null)_order_state = oMap.get("order_state").toString();
			if(oMap.get("num")!=null)_num = oMap.get("num").toString();
			if(_order_state.equals("0")) waitPay = _num;
			if(_order_state.equals("2")) waitConfirmShip = _num;
			if(_order_state.equals("3")) waitComment = _num;
		}
	}
	
	int waitCommentInt = Integer.parseInt(waitComment);
	int evaNum = evaluateInfo.getEvaluateCountByUserId(user_id);
	waitCommentInt = waitCommentInt - evaNum;
	
	if(waitCommentInt < 0){
		waitCommentInt = 0;
	}
	
	
	
	
%>

<HTML>
<head>
<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
<script type="text/javascript" language="jscript" src="/js/prototype.js"></script>   
<script type="text/javascript" src="floatDiv.js"></script>
<link href="/program/admin/index/css/floatDiv.css" rel="stylesheet" type="text/css" />


</head>

  <DIV class="right">
   <div class="cont_r" style="width:auto">
             <div class="cont_r_t" ></div>
			 
		     <div class="cont_r_c">
		            <div class="cont_r_c_t" style="height:auto">
					    <ul style="padding-top:10px; ">
						   <li><span class="cont_r_c_sp"><%=user_name%></span> 您好！欢迎光临世界绸都</li>
						   <!--<li>您目前的会员级别：<span class="cont_r_c_sp"><%=level_name%></span>，您可以享受<span class="cont_r_c_sp"><%=discount%>折</span>优惠</li>
						   -->
						   <li>截至 <%=str_date1%>，您共有<span class="cont_r_c_sp"> <%=waitComment%> </span>张订单完成交易，累计消费<span class="cont_r_c_sp"><%=paid%></span> 元。</li>
						   <li style="padding-left:10px;margin-top:10px;border:1px solid #C4D6DA;line-height:30px;">
								<b>我的交易提醒：</b>
								&nbsp;&nbsp;&nbsp;
								<%if(!waitPay.equals("0")){%>
								<a href="/program/member/order/index.jsp?o_order_state=0&menu_id=A627r83634Q86NP" style="color:#E7A712;">待付款(<%=waitPay%>)</font></a>
								<%}else{%>待付款(<%=waitPay%>)<%}%>
								&nbsp;&nbsp;&nbsp;
								<%if(!waitConfirmShip.equals("0")){%>
								<a href="/program/member/order/index.jsp?o_order_state=2&menu_id=A627r83634Q86NP" style="color:#E7A712;">待确认收货(<%=waitConfirmShip%>)</font></a>
								<%}else{%>待确认收货(<%=waitConfirmShip%>)<%}%>
								&nbsp;&nbsp;&nbsp;
								<%if(waitCommentInt != 0){%>
								<a href="/program/member/order/index.jsp?o_order_state=3&menu_id=A627r83634Q86NP" style="color:#E7A712;">待评价(<%=waitCommentInt%>)</font></a>
								<%}else{%>待评价(<%=waitCommentInt%>)<%}%>
								
							</li>
						</ul>
					</div>
		    </div>
		
		    <div class="cont_r_d"></div>
             </div>
</DIV>
	
<div class="f-right w750">
	<form action="index.jsp" name="homeForm" method="post">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" >
      <tr>
        <td>
		
		  <div class="ts"> <img src="/program/member/index/images/ts.gif" />
		  <a href="/index.html" target="_blank"><span style="color:#7F0019"><b>去商城看看有没有特价！</b></span></a>
		  </div>
		  
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="45" align="left">
              	订单号:
              <input type="text" class="input" name ="s_order_no" id= "s_order_no" maxlength="50">
			  下单时间:  
				          <input name="o_start_date" type="text" id="o_start_date" class="Wdate" value="" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'o_end_date\',{d:-1})}',readOnly:true})" size="15"  width="150px"/>
				            -
					        <input name="o_end_date" id="o_end_date" type="text" class="Wdate" value="" onclick="WdatePicker({minDate:'#F{$dp.$D(\'o_start_date\',{d:1})}',readOnly:true})" size="15" width="150px"/>
						  
			  <input type="button" name="seachorder" value="搜索" class="button2" onclick="document.homeForm.submit();">
			  </td>
            </tr>
          </table>
         
          <table width="100%" height="30" border="0" bgcolor="#eddfea"  cellspacing="0" cellpadding="2">
            <tr>
              <td width="20%" align="center">订单号</td>
			  <td width="10%" align="center">收货人</td>
              <td width="15%" align="center">商品总价</td>
			  <td width="15%" align="center">下单时间</td>
              <td width="10%" align="center">订单状态</td>
			  <td width="10%" align="center">操作</td>
            </tr>
          </table>
          <% 
			int listsize = 0;
			if(list!=null && list.size()>0){
				listsize = list.size();
				Hashtable map = new Hashtable();
				for(int i=0;i<list.size();i++){
					map = (Hashtable)list.get(i);
					String order_no="",all_total_amount="",add_time="",pay_id="",cust_id="",consignee="",order_state= "",state_name ="";
					if(map.get("order_no")!=null) {
						order_no = map.get("order_no").toString();
					}
					if(map.get("pay_id")!=null) pay_id = map.get("pay_id").toString();
					if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
					if(map.get("all_total_amount")!=null) all_total_amount = map.get("all_total_amount").toString();
					if(map.get("add_time")!=null) add_time = map.get("add_time").toString();
					if(add_time.length()>19)add_time=add_time.substring(0,19);
					if(map.get("consignee")!=null) consignee = map.get("consignee").toString();
					if(map.get("order_state")!=null) order_state = map.get("order_state").toString();
					 state_name = commparaInfo.getOneComparaPcode1("31",order_state);
					 boolean isNotEvaluate = evaluateInfo.checkIsnotEvaluate(order_no);
		%>
          <table width="100%" border="0"  cellpadding="0" cellspacing="0" style="border-bottom:1px dashed #acacac">
            <tr height="80">
              <td width="20%" align="center"><a href="/program/member/order/detailindex.jsp?order_no=<%=order_no %>&menu_id=A627r83634Q86NP" target="_blank"><%=order_no%></a></td>
              <td width="10%" align="center"><%=consignee%></td>
              <td width="15%" align="center">￥<%=all_total_amount%>元</td>
              <td width="15%" align="center"><%=add_time%></td>
			  <td width="10%" align="center" style="text-align:center;"><%=state_name%></br><a href="/program/member/order/detailindex.jsp?order_no=<%=order_no %>&menu_id=A627r83634Q86NP" title="查看订单详细"><br/>
			  <font color="#BB8600">订单详情</font></td>
			  <td width="10%" align="center">
	<%
						if(order_state.equals("0")){
					%>

					<%
					if(!pay_id.equals("0")){
					%>
						<!--<a href="/templets/jsp/order_confirm.jsp?trade_no=<%=order_no%>&gotoOnlinePay=1" target="_blank">
							<div style="background:url(/program/member/index/images/orderbg.jpg) repeat-x;width:57px;height:20px;line-height:20px;color:#fff;cursor:pointer;text-align:center;">付款</div>
						</a>-->
						
						<!--<div style="margin-top:2px"></div>
						<a href="/doTradeReg.do?order_no=<%=order_no%>&order_state=9&bpm_id=5590">
						  <div style="background:url(/program/member/images/orderbg.jpg) repeat-x;width:57px;height:20px;line-height:20px;color:#fff;cursor:pointer;text-align:center;">取消</div>
						</a>-->
						
					<%
						} else{
					%>	
						货到付款
					<%
							}
						}
					%>
					<%
						if(order_state.equals("2")){
					%>
						<a href="/doTradeReg.do?order_no=<%=order_no%>&order_state=3&bpm_id=5590">
						<div style="background:url(/program/member/images/orderbg.jpg) repeat-x;width:57px;height:20px;line-height:20px;color:#fff;cursor:pointer;text-align:center;">确认收货</div>
						</a>
					<%
						}
					%>
					<%
						if(order_state.equals("3") && isNotEvaluate){
					%>
						<a href="/program/member/memberevaluate/commentIndex.jsp?order_no=<%=order_no%>&cust_id=<%=cust_id%>&menu_id=4865kY45B7388tV">
						<div style="background:url(/program/member/images/orderbg.jpg) repeat-x;width:57px;height:20px;line-height:20px;color:#fff;cursor:pointer;text-align:center;">评价</div>
						</a>
					<%
						}
					%>
					<%
						if(!isNotEvaluate){
					%>
						<font color="#808080">已评价</font><br/>
						<a href="/program/member/memberevaluate/viewcommentindex.jsp?menu_id=4865kY45B7388tV&order_no=<%=order_no%>"><font color="#BB8600">评价详细</font></a>
					<%
						}
					%>		  
			  
			  </td>
            </tr>
          </table>
          <%
          		}
          	}
          %>
          
          <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="4%" height="35" align="center">
              	<%=pageString%>
              </td>
            </tr>
          </table>
           <input type="hidden" name="menu_id" id="menu_id" value="A627r83634Q86NP" />
			<input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
        </td>
      </tr>
    </table>
   </form>
  </div>	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
